package com.heima.prtice;

import java.util.HashSet;

public class HashSet02 {
    public static void main(String[] args) {
        //HadhSet练习
       //存储多个学生对象并遍历
        //要求:学生对象的成员变量相同，认为是同一个对象
        HashSet<Student>hashSet=new HashSet<>();
        Student student=new Student("zhangsan",22);
        Student student1=new Student("lisi",22);
        Student student3=new Student("wangwu",19);
        Student student4=new Student("wangwu",33);
        hashSet.add(student);
        hashSet.add(student1);
        hashSet.add(student3);
        hashSet.add(student4);
        for (Student student2 : hashSet) {
            System.out.println(student2);
        }

    }
}
